home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / Caml Light 0.7 / Caml Light 0.7 source / src / launch / camlc.tpl next >
Text File  |  1995-06-19  |  5KB  |  152 lines

  1. Set echo 0
  2. set casesensitive 1
  3. set exit 1
  4.  
  5. Set TempFile "{tempfolder}:camlc.temp.c"
  6.  
  7. Set stdlib "LIBDIR"
  8. Set linkalso 1
  9. Set includes ""
  10. Set compopt ""
  11. Set linkopt ""
  12. Set custom ""
  13. set customtype ""
  14. Set linkfiles ""
  15. Set cppc "CPPC"
  16. set coptppc ""
  17. set clinkppc "LINKPPC"
  18. set clinkoptppc ""
  19. set c68k "C68k"
  20. set copt68k ""
  21. set clink68k "LINK68k"
  22. set clinkopt68k ""
  23. set cfiles "`quote "{tempfile}"`"
  24. Set objfiles "`quote "{tempfile}.o"`"
  25. Set linkout Camlc.out
  26. set profile 0
  27. set p ""
  28. set prodump ""
  29. set proflags fm
  30.  
  31. if "{LANG}"
  32.   set compopt "-lang {LANG}"
  33.   set linkopt "-lang {LANG}"
  34. end
  35.  
  36. Loop
  37.   break if {#} == 0
  38.   If "{1}" =~ /≈.ml/
  39.     if {profile}
  40.       ("{stdlib}camlinstr" -m {proflags} -stdlib {stdlib} {includes} ∂
  41.                            {compopt} "{1}" "{1}t" ∂
  42.        && camlrun "{stdlib}camlcomp" -stdlib "{stdlib}" {includes} {compopt} ∂
  43.                   "{1}t") ∂
  44.       || ( set rc status; delete -i "{1}t"; exit {rc} )
  45.       delete -i "{1}t"
  46.     else
  47.       camlrun "{stdlib}camlcomp" -stdlib "{stdlib}" {includes} {compopt} "{1}"
  48.     end
  49.     Set linkfiles "{linkfiles} {1}"
  50.   Else If "{1}" =~ /≈.mli/
  51.     camlrun "{stdlib}camlcomp" -stdlib "{stdlib}" {includes} {compopt} "{1}"
  52.   Else If "{1}" =~ /≈.zo/
  53.     Set linkfiles "{linkfiles} {1}"
  54.   Else If "{1}" == "-c"
  55.     Set linkalso 0
  56.   Else If "{1}" == "-I" || "{1}" == "-include"
  57.     Set includes "{includes} -I {2}"
  58.     Shift
  59.   Else If "{1}" == "-O" || "{1}" == "-open"
  60.     Set compopt "{compopt} -O {2}"
  61.     Shift
  62.   Else If "{1}" == "-i"
  63.     Set compopt "{compopt} -i"
  64.   Else If "{1}" == "-g" || "{1}" == "-debug"
  65.     set compopt "{compopt} -g"
  66.     Set linkopt "{linkopt} -g"
  67.   Else If "{1}" == "-o" || "{1}" == "-exec"
  68.     Set linkout "{2}"
  69.     Shift
  70.   Else If "{1}" == "-stdlib"
  71.     Set stdlib "{2}"
  72.     Shift
  73.   Else If "{1}" == "-v" || "{1}" == "-version"
  74.     Echo "The Caml Light system, version VERSION"
  75.     Echo "  (standard library from {stdlib})"
  76.     camlrun -V
  77.     camlrun "{stdlib}camlcomp" -version
  78.     camlrun "{stdlib}camllink" -version
  79.   Else If "{1}" == "-files"
  80.     Set linkfiles "{linkfiles} -files {2}"
  81.     Shift
  82.   Else If "{1}" == "-custom"
  83.     Set custom "-custom `quote "{TempFile}"`"
  84.     set customtype fat
  85.   Else If "{1}" == "-custom68k"
  86.     Set custom "-custom `quote "{TempFile}"`"
  87.     set customtype 68k
  88.   Else If "{1}" == "-customPPC"
  89.     Set custom "-custom `quote "{TempFile}"`"
  90.     set customtype PPC
  91.   else if "{1}" == "-lang"
  92.     set compopt "{compopt} -lang {2}"
  93.     set linkopt "{linkopt} -lang {2}"
  94.     shift
  95.   else if "{1}" == "-W"
  96.     set compopt "{compopt} -W"
  97.   Else If "{1}" =~ /≈.c/
  98.     Set cfiles "{cfiles} `quote "{1}"`"
  99.     set objfiles "{objfiles} `quote "{1}.o"`"
  100.   Else If "{1}" =~ /≈.o/ || "{1}" =~ /≈[Ll]ib/
  101.     if "{customtype}" == fat
  102.       echo "cannot link C object files in fat custom mode." >dev:stderr
  103.       echo "use -clinkoptPPC <file> and -clinkopt68k <file> instead" >dev:stderr
  104.       exit 1
  105.     end
  106.     Set objfiles "{objfiles} `quote "{1}"`"
  107.   else if "{1}" == "-c68k"
  108.     set c68k "{2}"
  109.     shift
  110.   else if "{1}" == "-cPPC"
  111.     set cppc "{2}"
  112.     shift
  113.   Else If "{1}" == "-copt68k"
  114.     Set copt68k "{copt68k} {2}"
  115.     Shift
  116.   Else If "{1}" == "-coptPPC"
  117.     Set coptPPC "{coptPPC} {2}"
  118.     Shift
  119.   else if "{1}" == "-clink68k"
  120.     set clink68k "{2}"
  121.     shift
  122.   else if "{1}" == "-clinkPPC"
  123.     set clinkPPC "{2}"
  124.     shift
  125.   else if "{1}" == "-clinkopt68k"
  126.     set clinkopt68k "{clinkopt68k} {2}"
  127.     shift
  128.   else if "{1}" == "-clinkoptPPC"
  129.     set clinkoptPPC "{clinkoptPPC} {2}"
  130.     shift
  131.   else if "{1}" =~ /-p(≈)®0/
  132.     set profile 1
  133.     set p p
  134.     set prodump `quote "{stdlib}prodump.zo"`
  135.     if "{®0}"
  136.       set proflags "{®0}"
  137.     end
  138.   Else If "{1}" =~ /-≈/
  139.     Echo "Unknown option ∂"{1}∂", ignored" >Dev:Stderr
  140.   Else
  141.     Echo "I don't know what to do with file ∂"{1}∂", ignored" >Dev:Stderr
  142.   End
  143.   Shift
  144. End
  145.  
  146. If {linkalso} && "{linkfiles}" != ""
  147.   camlrun "{stdlib}camllink" -stdlib "{stdlib}" {includes} {linkopt} {custom} ∂
  148.           -exec "{linkout}" "{stdlib}stdlib{p}.zo" {linkfiles} {prodump}
  149.   setfile -c 'MPS ' -t TEXT "{linkout}"
  150.   if "{customtype}"
  151.     move -y "{linkout}" "{TempFile}C"
  152.     If "{customtype}" == fat || "{customtype}" == 68k